Wiki
New
List all pages
Page name
Content
1. Set up Docker's apt repository. ``` # Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update ``` 2. Install the Docker packages. `sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin` 3. Post-installation Create the docker group. `sudo groupadd docker` Add your user to the docker group. `sudo usermod -aG docker $USER` Log out and log back in so that your group membership is re-evaluated, or activate the changes to groups: `newgrp docker` Verify that you can run docker commands without sudo. `docker run hello-world` 3. Configure default logging driver Docker provides logging drivers for collecting and viewing log data from all containers running on a host. The default logging driver, json-file, writes log data to JSON-formatted files on the host filesystem. Over time, these log files expand in size, leading to potential exhaustion of disk resources. To avoid issues with overusing disk for log data, consider one of the following options: - Configure the json-file logging driver to turn on log rotation. - Use an alternative logging driver such as the "local" logging driver that performs log rotation by default. - Use a logging driver that sends logs to a remote logging aggregator. 4. Configure the json-file logging driver to turn on log rotation. To use the json-file driver as the default logging driver, set the log-driver and log-opts keys to appropriate values in the daemon.json file, which is located in /etc/docker/ on Linux hosts or C:\ProgramData\docker\config\ on Windows Server. If the file does not exist, create it first. For more information about configuring Docker using daemon.json, see daemon.json. The following example sets the log driver to json-file and sets the max-size and max-file options to enable automatic log-rotation. ``` { "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3" } } ```
Save